<%@ page language="java" import="java.util.*,ms.platform.system.model.*"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
<title>金型计划修改</title>
<base href="<%=basePath%>">

<jsp:include page="../../jsp/public.jsp" flush="true"/>
<style type="text/css">
#meterTabInfoList td{border:1px solid !important;border-collapse:collapse !important;}
</style>
<script type="text/javascript" src="<%=basePath%>js/plan/edit.js"></script>
</head>
<body>

        
        <div class="row">
            
            <div class="col-lg-12">
                <div class="index-nav-right">
                    <div class="index-nav-right-header"><span>当前位置>金型计划修改</span></div>
                </div>

                <div class="add-one-right">
                    <!--进度条S-->
                    <div class="progress-con">
                        <div class="progress-step">
                            <div class="progress-step-one">
                                <span class="step-line step-line-right step-line-gray step-line-green"></span>
                                <span class="step-circle step-line-green">
                                    <i>1</i>
                                </span>
                                <span class="step-line step-line-left step-line-green"></span>
                            </div>
                            <div class="progress-step-two">
                                <span>部品信息</span>
                            </div>
                        </div>
                        <div class="progress-step">
                            <div class="progress-step-one">
                                <span class="step-line step-line-right step-line-gray"></span>
                                <span class="step-circle step-line-gray">
                                    <i>2</i>
                                </span>
                                <span class="step-line step-line-left step-line-gray"></span>
                            </div>
                            <div class="progress-step-two">
                                <span>计划信息</span>
                            </div>
                        </div>
                        <div class="progress-step">
                            <div class="progress-step-one">
                                <span class="step-line step-line-right step-line-gray"></span>
                                <span class="step-circle step-line-gray">
                                    <i>3</i>
                                </span>
                                <span class="step-line step-line-left step-line-gray"></span>
                            </div>
                            <div class="progress-step-two">
                                <span>完成</span>
                            </div>
                        </div>
                    </div>
                    <!--进度条E-->

                    <!--表单信息输入-->
                    <!--表单信息输入第一步-->
                    <input type="hidden" name="modelId" id= "modelId" value="${model.id }">
                    <div class="addInfo-one" id="departmentId">
                        <div class="row add-one-form-rowHeight">
                            <div class="form-group col-lg-5 col-lg-offset-1">
                                <label class="col-lg-3 control-label add-one-form-label">部品番号<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelCode" value="${model.modelCode }"/>
                                </div>
                            </div>
                            <div class="form-group col-lg-5">
                                <label class="col-lg-3 control-label add-one-form-label">设变号:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="changeNo" value ="${model.changeNo }">
                                </div>
                            </div>
                            <%-- <div class="form-group col-lg-5">
                                <label class="col-lg-3 control-label add-one-form-label">工程<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="engineering" value ="${model.engineering }"/>
                                </div>
                            </div> --%>
                        </div>
                        <div class="row add-one-form-rowHeight">
                            <div class="form-group col-lg-5 col-lg-offset-1">
                                <label class="col-lg-3 control-label add-one-form-label">机种<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelType" value="${model.modelType }">
                                </div>
                            </div>
                            <div class="form-group col-lg-5">
                                <label class="col-lg-3 control-label add-one-form-label">量产设备(BL)<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelBl" value="${model.modelBl }">
                                </div>
                            </div>
                        </div>
                        <div class="row add-one-form-rowHeight">
                            <div class="form-group col-lg-5 col-lg-offset-1">
                                <label class="col-lg-3 control-label add-one-form-label">部品难易度<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <select class="form-control" id="modelLevel">
                                    	<option value="S" <c:if test="${model.modelLevel == 'S'}">selected</c:if>>S
                                        	</option>
                                        <option value="A" <c:if test="${model.modelLevel == 'A'}">selected</c:if>>A
                                        </option>
                                        <option value="B" <c:if test="${model.modelLevel == 'B'}">selected</c:if>>B
                                        </option>
                                        <option value="C" <c:if test="${model.modelLevel == 'C'}">selected</c:if>>C
                                        </option>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group col-lg-5">
                                <label class="col-lg-3 control-label add-one-form-label">机床信息(PR):</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelPr" value="${model.modelPr }">
                                </div>
                            </div>
                        </div>
                        <div class="row add-one-form-rowHeight">
                            <div class="form-group col-lg-5 col-lg-offset-1">
                                <label class="col-lg-3 control-label add-one-form-label">板厚<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelPly" value ="${model.modelPly }">
                                </div>
                            </div>
                            <div class="form-group col-lg-5">
                                <label class="col-lg-3 control-label add-one-form-label">所属客户<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="customer" value ="${model.customer }">
                                </div>
                            </div>
                        </div>
                        <div class="row add-one-form-rowHeight">
                            <div class="form-group col-lg-5 col-lg-offset-1">
                                <label class="col-lg-3 control-label add-one-form-label">材质<span class = "font-red">*</span>:</label>
                                <div class="col-lg-7">
                                    <input type="text" class="form-control" id="modelTexture" value="${model.modelTexture }">
                                </div>
                            </div>
                        </div>
                        <div class="row add-one-form-rowHeight">
                            <div class="col-lg-1 col-lg-offset-2">
                                <button type="button" class="btn navbar-default" onClick = "getTableValue()">保存</button>
                            </div> 
                            <div class="col-lg-1">
                                <button type="button" class="btn navbar-default" onclick="nextOne()">下一步</button>
                            </div>
                        </div>
                    </div>
                    <!--表单信息输入第一步E-->
                    <!--表单信息输入第二步-->
                    <input type = "text" hidden = "true" id="modelPlanId" value = "${model.modelPlanId }"/>
                    <div class="addInfo-two" id="planId" hidden = "true" style = "width:98%">
                        <div class="row addInfo-two-search clearFix">
                            <div>
                                <label>部品番号<span class = "font-red">*</span>:</label>
                                <input type="text" style = "width:200px;" id = "modelCode2" readonly="readonly" value="${model.modelCode }"/>
                            </div>
                            <div>
                                <label>厂家<span class = "font-red">*</span>:</label>
                                <select name="factory" id="factory" style = "width:200px;">
                                    <option value = ""></option>
												<c:if test="${not empty factory}">
													<c:forEach items="${factory }" var="factory" varStatus="m">
														<option value = "${factory.orgCode }" <c:if test="${model.factory == factory.orgCode}">selected</c:if>>${factory.orgName}</option>
													</c:forEach>
												</c:if>
                                </select>
                            </div>
                            <div>
                                <label>计划开始<span class = "font-red">*</span>:</label>
                                <input type="text" style = "width:200px;" class = "Wdate" name="planStartTime" id="planStartTime"
												onClick="WdatePicker({dateFmt:'yyyy-MM-dd',onpicked:calculatePlanTime})" value = "${model.planStartTimeText }"/>
                            </div>
                            <div style = "margin-right:1000px;">
                                <label>计划完成<span class = "font-red">*</span>:</label>
                                <input type="text" style = "width:200px;"  disabled class="input-read" name="planEndTime" id = "planEndTime" value = "${model.planEndTimeText }"/>
                            </div>
                            <div style = "width:335px;">
                                <label style ="width:75px;">总工时(天)<span class = "font-red">*</span>:</label>
                                <input type="text" style = "width:200px;" disabled class="input-read" name="totalDay" id = "totalDay" value="${ model.planTotalTime}"/>
                            </div>
                            <%-- <div>
                                <label>类别<span class = "font-red">*</span>:</label>
                                <select name="type" id="type" style = "width:200px;">
									<option value = "1" <c:if test="${model.type == '1'}">selected</c:if>>一次型</option>
									<option value = "2" <c:if test="${model.type == '2'}">selected</c:if>>二次型</option>
                                </select>
                            </div> --%>
                        </div>
                        <div class="row addInfo-two-table">
                            <table class="table table-striped" id = "process_model">
                                <thead>
                                <tr class="table-thead">
                                    		<td>工序名称</td>
											<td>参考耗时(天)</td>
											<td>预计耗时</td>
											<td>单位</td>
											<td>工序开始</td>
											<td>工序结束</td>
											<td>精度(%)</td>
											<td>操作</td>
                                </tr>
                                </thead>
                                <tbody id="processText">
                                <c:if test="${not empty process}">
										<c:forEach items="${process }" var="pro" varStatus="r">
											<tr id="${pro.id }">	
												<td>${pro.processName }</td>
												<td>${pro.refTime }</td>
												<td><input type = "text" value = "${pro.planTotalTime }" id= "hs${r.index }"></td>
												<td><span>天</span>
												</td>
												<td id= "startTime${r.index }"><span>${pro.planStartTimeText }</span></td>
												<td id= "endTime${r.index }"><span>${pro.planEndTimeText }</span></td>
												<td><input type = "text" value = "${pro.targetPre }"/></td>
												<td>
													<span <c:if test="${pro.accEndTime == null and r.index<3 }" >class = "hand-like" onClick = "complete(${r.index+1})" </c:if>>
														<c:choose>
															<c:when test="${pro.accEndTime != null and r.index<3}">已完成</c:when>
															<c:when test="${pro.accEndTime == null and r.index<3}">完成</c:when>
															<c:otherwise></c:otherwise>
														</c:choose>															
													</span>
												</td>
											</tr>
										</c:forEach>
									</c:if>
                                </tbody>
                            </table>
                        </div>
                        <div class="add-one-form-rowHeight add-one-form-button">
                            <div class="">
                                <button type="button" class="btn navbar-default" onClick="getTableValue()">保存</button>
                            </div>
                            
                            <div class="">
                                <button type="button" class="btn navbar-default" onclick="previousStep()">上一步</button>
                            </div>
                        </div>
                    </div>
                    <!--表单信息输入第二步E-->
                    <!--表单信息输入第三步-->
                    <div class="addInfo-three" id = "materials" hidden = "true">
                        <div class="row">
                            <div class="row addInfo-two-search clearFix">
                                <div>
                                    <label>部品番号</label>
                                    <input type="text" id = "modelCode3" readonly="readonly" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>用途</label>
                                    <select name="useFor" id="useFor" style = "width:200px">
                                       	<option value="取样">取样</option>
										<option value="调试">调试</option>
                                    </select>
                                </div>
                                <div>
                                    <label>长</label>
                                    <input type="text" name="grow" id="grow" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>幅</label>
                                    <input type="text"  name="wide" id = "wide" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>板厚</label>
                                    <input type="text" name="tall" id="tall" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>计划枚数</label>
                                    <input type="text" name="planNum" id = "planNum" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>每枚可取数</label>
                                    <input type="text" name="perNum" id="perNum" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>可取台数</label>
                                    <input type="text" name="planAmount" id = "planAmount" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>下发时间</label>
                                    <input type="text" class = "Wdate" name="giveTime" id="giveTime"
												onClick="WdatePicker()" style = "width:200px"/>
                                </div>
                                <div>
                                    <label>下发人</label>
                                    <input type="text" name="operator" id = "operator" style = "width:200px"/>
                                </div>
                            </div>
                            <div class="add-one-form-rowHeight add-one-form-button">
                                <div class="">
                                    <button type="button" class="btn navbar-default"  onClick = "saveMeterTabInfo()">保存</button>
                                </div>
                                <div class="">
                                    <button type="button" class="btn navbar-default" onClick = "continueToAdd()">继续添加材料</button>
                                </div>
                                <div class="">
                                    <button type="button" class="btn navbar-default" onClick="getTableValue()">提交</button>
                                </div>
                                <div class="">
                                    <button type="button" class="btn navbar-default" onClick="previousStepTwo()">上一步</button>
                                </div>
                            </div>
                            <input type = "text" hidden = "true" id="meterId" value = ""/>
                            <div class="row" id = "meterInfoList">
                                <div class="row addInfo-two-table">
                                    <table class="table table-striped" id= "meterTabInfoList" style = "width:1000px;">
                                        <thead>
                                        <tr class="table-thead">
                                            <th>部品番号</th>
                                            <th>用途</th>
                                            <th>长</th>
                                            <th>幅</th>
                                            <th>板厚</th>
                                            <th>计划枚数</th>
                                            <th>每枚可取数</th>
                                            <th>可取台数</th>
                                            <th>下发时间</th>
                                            <th>下发人</th>
                                            <th>操作</th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        	<c:if test="${not empty meter}">
										<c:forEach items="${meter }" var="meter" varStatus="m">
											<tr id = "${meter.id }">	
												<td>${meter.modelCode }</td>
												<td>${meter.useFor }</td>
												<td>${meter.grow }</td>
												<td>${meter.wide }</td>
												<td>${meter.tall }</td>
												<td>${meter.planNum }</td>
												<td>${meter.perNum }</td>
												<td>${meter.planAmount }</td>
												<td>${meter.giveTimeText }</td>
												<td>${meter.operator }</td>
												<td><span style = "cursor:pointer;" onClick = "queryModelMeterById(${meter.id})">修改</span><span style = "cursor:pointer;" onClick = "deleteMeter(this,${meter.id})">删除</span></td>
											</tr>
										</c:forEach>
									</c:if>
                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!--表单信息输入第三步E-->
                    <!--表单信息输入-->

                </div>
            </div>
        </div>
        <!--提交成功弹窗-->
        <button type="button" id= "stay" hidden = "true" class="" data-toggle="modal"  data-target="#myModal">保存</button>
       <div class="row">
           <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
               <div class="modal-dialog addInfo-alert-con">
                   <div class="modal-content">
                       <div class="modal-body addInfo-alert-body">
                           <img src="<%=basePath%>/images/new/success.png" alt="" id="myModalAlertImg"/>
                           <div id="myModalAlertText">提交成功</div>
                       </div>
                       <div class="modal-footer addInfo-alert-footer">
                           <button type="button" class="btn navbar-default" data-dismiss="modal">确定</button>
                       </div>
                   </div><!-- /.modal-content -->
               </div><!-- /.modal -->
           </div>
       </div>
        <!--提交失败弹窗-->
        <div class="row">
            <div class="modal fade" id="alertErr" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog addInfo-alert-con">
                    <div class="modal-content">
                        <div class="modal-body addInfo-alert-body">
                            <img src="<%=basePath%>/images/new/fail.png" alt="" />
                            <div>提交失败</div>
                        </div>
                        <div class="modal-footer addInfo-alert-footer">
                            <button type="button" class="btn navbar-default" data-dismiss="modal">确定</button>
                        </div>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal -->
            </div>
        </div>
        <input type = "text" hidden = "true" id = "mapfactory" value="${map['factory'] }"/>
        <input type="text" hidden = "true"  id="mapType" value="${map['modelType'] }"/>
        <input type="text" hidden = "true"  id="mapLevel" value="${map['modelLevel'] }"/>
        <input type="text" hidden = "true"  id="mapEngineering" value="${map['engineering'] }"/>
        <input type = "text" hidden = "true" id = "mapCode" value="${map['modelCode'] }"/>
        <input type = "text" hidden = "true" id = "mapStatus" value="${map['planStatus'] }"/>
        <input type = "text" hidden = "true" id = "mapPage" value="${map['mapPage'] }"/>
</body>
</html>
